/**************************************************************************************
*
*	Copyright (C) 2010 - 2012 Brent Andrew O. Chua - See LICENSE.txt for more info.
*		
*	Filename	-	CameraRenderPathSettingsLPP
*
*	Description -	Settings and data specific to the view to be used by the 
*					Light Pre-Pass render path
*
*	Comments	-	TODO: Make it so that this implementation is derived from 
*						IRenderPathViewSettings interface.
*
*	Modification History:
*			Name			   Date					Description
*			MrCodeSushi	-	05/11/2013		-	File creation
**************************************************************************************/
#ifndef _PSX_LPP_VIEW_SETTINGS_H_
#define _PSX_LPP_VIEW_SETTINGS_H_

#include "PulseSTD.h"

namespace Pulse
{
	class CameraRenderPathSettingsLPP
	{
	public:

		void ReleaseTextureBuffers( void );

		// NOTE: Release and recreate new texture buffers 
		//	to the view's updated size
		EErrorCode::Type UpdateBufferSizes( void );

		Texture2D * GetCompositeTexture( void );

		virtual void OnRender( RenderView *pView );

	private:

		friend RenderPathLightPrePass;

		CameraRenderPathSettingsLPP( ComponentCamera *pCamera );

		virtual ~CameraRenderPathSettingsLPP( void );

		EErrorCode::Type Initialize( void );

		void Cleanup( void );

	private:

		// Utility Methods
		//////////////////

		void BindTextureBuffers( Texture2D *pDepthBuffer, Texture2D *pNormalBuffer,
			Texture2D *pLightBuffer, Texture2D *pCompositeBuffer );

	private:

		ComponentCamera *m_pCameraOwner;

		// Buffers
		Texture2D	*m_pDepthBuffer;
		Texture2D	*m_pNormalBuffer;
		Texture2D	*m_pLightBuffer;
		Texture2D	*m_pCompositeBuffer; 

		// States
		DepthStencilState *m_pDSState2n3;

		// Render entries
		RenderEntryViewport				*m_pREViewport; // TODO: Move this in camera

		// Geometry pass
		RenderEntryRenderTarget			*m_pRERenderTarget1;		
		RenderEntryDepthStencilState	*m_pREDepthStencil1;
		RenderEntryClearPipeline		*m_pREClearPipeline1;

		// Light pass
		RenderEntryRenderTarget			*m_pRERenderTarget2;		
		RenderEntryDepthStencilState	*m_pREDepthStencil2;

		RenderEntryBindParameters		*m_pREBindParams2;
		RenderEntryClearPipeline		*m_pREClearPipeline2;

		// Composite pass
		RenderEntryRenderTarget			*m_pRERenderTarget3;		
		RenderEntryDepthStencilState	*m_pREDepthStencil3;
		RenderEntryBindParameters		*m_pREBindParams3;
		RenderEntryClearPipeline		*m_pREClearPipeline3;

		RenderEntryPresent				*m_pREPresent;

	};
}

#endif /* _PSX_LPP_VIEW_SETTINGS_H_ */